from pydantic import BaseModel, Field


class MemberBase(BaseModel):
    name: str
    email: str

    model_config = {
        "from_attributes": True
    }


class MemberResp(MemberBase):
    id: int


class MemberCreateReq(BaseModel):
    name: str = Field(..., title="姓名", min_length=1, max_length=300)
    email: str = Field(..., title="邮箱", min_length=1, max_length=300)


class MemberUpdateReq(MemberCreateReq):
    id: int = Field(..., title="ID", ge=1)


class MemberReq(BaseModel):
    name: str | None = None
    email: str | None = None
    id: int = 0
    page: int = 1
    limit: int = 5
